package com.ymatou.search;

import java.util.HashSet;
import java.util.List;

import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
import com.ymatou.util.Logger;
import com.ymatou.util.Random;

@SuppressWarnings("deprecation")
public class SearchHotSuggestTest extends UiAutomatorTestCase{
	
	private static final String TAG = SearchHotSuggestTest.class.getSimpleName();
	private List<UiObject> objectList;
	
	public SearchHotSuggestTest(List<UiObject> objectList) {
		this.objectList = objectList;
	}
	
	
	public void testClickHotSuggest() throws UiObjectNotFoundException {
		
		//随机取一个热门推荐词并点击
		HashSet<Integer> set = new HashSet<Integer> ();
		
		Random.randomSet(0, objectList.size(), 1, set);
		
		for (int j : set) {  
			UiObject o = objectList.get(j);
        	o.click();
        	Logger.log(TAG, "点击热门搜索词" + o.getText());
    	};
	}
}
